/**
 * 
 */

var Fieldset = new Class.create({
    initialize : function() {
        Element.observe(document,'dom:loaded',function(){
            this._init();
        }.bind(this));
    },

    _init : function() {
        $$('div.fieldset').each(function(element){
            var head = element.down('.box-head');
            var form = element.down('div.form');
            if(form.hasClassName('close')) {
                form.addClassName('display-no');
            }
            Element.observe(head,'click',this.head.bind(this,element));
        }.bind(this));
    },

    head : function(element,event) {
        var form = element.down('div.form');
        if(form.hasClassName('display-no')) {
            form.removeClassName('display-no');
        } else {
            form.addClassName('display-no');
        }
    }
});